package vip.george.bean.beanfactory;

import org.springframework.beans.factory.FactoryBean;
import vip.george.bean.animal.Dog;

public class DogFactoryBean implements FactoryBean<Dog> {


    @Override
    public Dog getObject() throws Exception {
        //这里可以做其他的一些逻辑，比如检测信息等
        Dog dog = new Dog();
        dog.setName("dog(我是工厂类创建的)");
        dog.setAge(18);
        return dog;
    }

    @Override
    public Class<?> getObjectType() {
        return Dog.class;
    }


    /**
     * 是否单例,默认是true
     * @return
     */
    @Override
    public boolean isSingleton() {
        return FactoryBean.super.isSingleton();
    }
}
